package com.example.netty.protocoltcp;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class MyServerInitilalizer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        // 数据进入 server ，需要解码，入站解码器
        pipeline.addLast(new MyMessageDecoder())
                // 数据从 server 出，需要编码，出站编码器
                .addLast(new MyMessageEncoder())
                .addLast(new MyServerhandler());
    }
}
